#include <bits/stdc++.h>

#define N 8010

using namespace std;

int n, q, a[N], op, x, v;

struct Num 
{
	int pos, val;
	bool operator< (const Num x) const
	{
		if (val != x.val) return val < x.val;
		else return pos < x.pos;
	}
} b[N];

int main (void)
{
	freopen("sort.in", "r", stdin);
	freopen("sort.out", "w", stdout);
	scanf("%d %d", &n, &q);
	for (int i = 1; i <= n; i ++)
		scanf("%d", a + i);
	for (int i = 1; i <= q; i ++)
	{
		scanf("%d", &op);
		if (op == 1)
		{
			scanf("%d %d", &x, &v);
			a[x] = v;
		}
		else if (op == 2)
		{
			scanf("%d", &x);
			for (int j = 1; j <= n; j ++)
				b[j].val = a[j], b[j].pos = j;
			sort(b + 1, b + n + 1);
			for (int j = 1; j <= n; j ++)
				if (a[x] == b[j].val && b[j].pos == x)
				{
					printf("%d\n", j);
					break;
				}
		}
	}
	
}
